package yu.vert.queue;

import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit;

public class MyUser implements Delayed {

    private String id;
    private Long expireTime;

    public MyUser(String id, Long expireTime){
        super();
        this.id = id;
        this.expireTime = expireTime;
    }

    @Override
    public long getDelay(TimeUnit unit) {
        return expireTime - System.currentTimeMillis();
    }

    @Override
    public int compareTo(Delayed o) {
        return Long.valueOf(this.expireTime).compareTo(Long.valueOf(((MyUser)o).expireTime));
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Long getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(Long expireTime) {
        this.expireTime = expireTime;
    }
}
